<?php

namespace app\mingteng\model;

use think\Model;
use traits\model\SoftDelete;

class Material extends Model
{
    use SoftDelete;
    protected $name = 'material';
    protected $autoWriteTimestamp = 'datetime';
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';
    protected $hidden = [
        'deletetime'
    ];
    public function user(){
        return $this->belongsTo(UserAdmin::class,'user_id','user_admin_id');
    }
    public function getImgsAttr($value){
        if(!empty($value)){
            $value = explode(',',$value);
        }else{
            $value = [];
        }
        return $value;
    }
}